package cn.onecloud.examples;

import java.util.Date;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.onecloud.examples.Student;
import cn.onecloud.examples.StudentDao;

/**
 * @author Keijack
 *
 */
@Service
public class StudentService0 {

    @Autowired
    private StudentDao dao;

    public List<Student> list(String nameLike) {
	return dao.query(nameLike);
    }

    public void add(String name) {
	Student student = new Student();
	student.setName(name);
	student.setCreateTime(new Date());
	dao.add(student);
    }

    public void update(Integer id, String name) {
	Student student = dao.get(id);
	student.setName(name);
	dao.update(student);
    }

}
